package com.liuchuanzheng.lcz_wanandroid.module.detail.pop

import android.content.Context
import android.view.View
import android.view.View.OnClickListener
import android.widget.LinearLayout
import com.liuchuanzheng.lcz_wanandroid.R
import com.lxj.xpopup.core.BottomPopupView


class BottomToolPop(
    context: Context,
    var listener: ResultListener
) : BottomPopupView(context) {
    enum class ClickType {
        COLLECT,SHARE,EXPLORER,COPY,REFRESH
    }

    lateinit var llCollect: LinearLayout
    lateinit var llShare: LinearLayout
    lateinit var llExplorer: LinearLayout
    lateinit var llCopy: LinearLayout
    lateinit var llRefresh: LinearLayout

    override fun getImplLayoutId(): Int {
        return R.layout.pop_detail_tool
    }

    override fun onCreate() {
        super.onCreate()
        llCollect = findViewById(R.id.llCollect)
        llShare = findViewById(R.id.llShare)
        llExplorer = findViewById(R.id.llExplorer)
        llCopy = findViewById(R.id.llCopy)
        llRefresh = findViewById(R.id.llRefresh)

        llCollect.setOnClickListener(OnClickListener { v: View ->
            dismiss()
            listener.onCkecked(ClickType.COLLECT)
        })
        llShare.setOnClickListener(OnClickListener { v: View ->
            dismiss()
            listener.onCkecked(ClickType.SHARE)
        })
        llExplorer.setOnClickListener(OnClickListener { v: View ->
            dismiss()
            listener.onCkecked(ClickType.EXPLORER)
        })
        llCopy.setOnClickListener(OnClickListener { v: View ->
            dismiss()
            listener.onCkecked(ClickType.COPY)
        })
        llRefresh.setOnClickListener(OnClickListener { v: View ->
            dismiss()
            listener.onCkecked(ClickType.REFRESH)
        })

    }

    //完全可见执行
    override fun onShow() {
        super.onShow()
    }

    //完全消失执行
    override fun onDismiss() {}
    interface ResultListener {
        fun onCkecked(action: ClickType)

    }
}